package unit4.part12.parking;

public class CarCounter {
    private int num;
    private CarType carType;

    public CarCounter(String str) {
        String[] strs = str.split(",");
        this.carType = CarType.valueOf(strs[0]);
        this.num = Integer.parseInt(strs[1]);
    }

    public boolean decrease() {
        if (num > 0) {
            num--;
            return true;
        } else {
            return false;
        }
    }

    public CarType getCarType() {
        return carType;
    }
}
